package com.fr.privilege.authentication;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class AuthenticationFactory
{
  public static Authentication platformAuthentication(HttpServletRequest paramHttpServletRequest)
  {
    Object localObject1 = new UsernamePasswordAuthentication("admin", "admin");
    HttpSession localHttpSession = paramHttpServletRequest.getSession(false);
    if (localHttpSession != null)
    {
      Object localObject2 = localHttpSession.getAttribute("platform_authentication_key");
      if (localObject2 instanceof Authentication)
        localObject1 = (Authentication)localObject2;
    }
    return ((Authentication)localObject1);
  }

  public static Authentication extractAuthentication(HttpServletRequest paramHttpServletRequest)
  {
    Authentication localAuthentication = null;
    HttpSession localHttpSession = paramHttpServletRequest.getSession(false);
    if (localHttpSession != null)
    {
      Object localObject = localHttpSession.getAttribute("fr_authentication_key");
      if (localObject instanceof Authentication)
        localAuthentication = (Authentication)localObject;
    }
    return localAuthentication;
  }
}